package com.lagou.service.impl;


import com.lagou.dao.ArticleDao;
import com.lagou.pojo.Article;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;


@Service
public class ArticleServiceImpl implements ArticleService {


    @Autowired
    ArticleDao articleDao;

    @Override
    public Page<Article> page(Integer pageNum, Integer pageSize) throws Exception {

        Pageable pageable =  PageRequest.of(pageNum-1 ,pageSize);

        return articleDao.findAll(pageable);
    }
}
